import { api } from '@/utils/request'
import type {
  Anniversary,
  CreateAnniversaryRequest,
  UpdateAnniversaryRequest,
} from '@/types/anniversary'

/**
 * 获取所有纪念日
 */
export const getAnniversaries = () => {
  return api.get<Anniversary[]>('/anniversaries')
}

/**
 * 获取单个纪念日
 */
export const getAnniversary = (id: number) => {
  return api.get<Anniversary>(`/anniversaries/${id}`)
}

/**
 * 创建纪念日
 */
export const createAnniversary = (data: CreateAnniversaryRequest) => {
  return api.post<Anniversary>('/anniversaries', data)
}

/**
 * 更新纪念日
 */
export const updateAnniversary = (id: number, data: UpdateAnniversaryRequest) => {
  return api.put<Anniversary>(`/anniversaries/${id}`, data)
}

/**
 * 删除纪念日
 */
export const deleteAnniversary = (id: number) => {
  return api.delete(`/anniversaries/${id}`)
}
